<?php
namespace  App\Http\Controllers\Api\V1;
use App\Models\Feedback;
use App\TraitHelper\RequestHelper;
use Illuminate\Http\Request;

/**
 * Created by PhpStorm.
 * User: xinghuo
 * Date: 2017/7/11
 * Time: 上午12:56
 */
class FeedbackController
{
    use RequestHelper;

    public function add(Request  $request)
    {
        $content = $request->input('content');
        $type = $request->input('type');
        $userInfo = $this->getLoginUserInfo($request);
        $feed = new Feedback();
        $feed->user_id = $userInfo['id'];
        $feed->content =  $content;
        $feed->type =  $type;
        $saveResult = $feed->save();
        return $this->formatJson($saveResult > 0, [], '您反馈已递交成功!感谢您的反馈.');
    }
}